package com.myblog.mapper;

import com.myblog.model.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CategoryMapper {

    @Select("select * from categories")
    List<Category> selectAll();

    @Select("select * from categories where categoryName = #{categoryName}")
    Category selectByName(@Param(value = "categoryName") String categoryName);

    @Insert("insert into categories (categoryName) value(#{categoryName})")
    void addCategory(String categoryName);

    @Delete("delete from categories where categoryName = #{categoryName}")
    void deleteCategory(@Param(value = "categoryName") String categoryName);

}
